#ifndef HTTPSERVER_H
#define HTTPSERVER_H

/*
 * This class implements a simple HTTP server that parses HTTP requests from
 *  different IP addresses and sends a signal to notify the result of the parsing.
 * // http://localhost:8080/{channel_name}/{state}
 */

#include <QObject>
#include <QTcpServer>
#include <QAbstractHttpServer>
#include <QHostAddress>
#include <QHttpServer>

class HttpServer : public QObject
{
    Q_OBJECT
public:
    explicit HttpServer(QObject *parent = nullptr);
    ~HttpServer();
    static HttpServer *getInstance();

signals:
    void logsPrintSignal(QString s);
    void requestInd(QString channelName, QString state);

public:
    int start(int port);
    int stop();

private:
    QTcpServer      *mQTcpServer;
    QHttpServer     mQHttpServer;

    void log(QString s);

};

#endif // HTTPSERVER_H
